package com.haixiaoke.saas.repository.service.impl;


import com.haixiaoke.saas.repository.mapper.DecorationMapper;
import com.haixiaoke.saas.repository.pojo.Decoration;
import com.haixiaoke.saas.repository.service.IDecorationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 装修情况Service业务层处理
 *
 * @author zhiping
 * @date 2023-04-06
 */
@Service
public class DecorationServiceImpl implements IDecorationService {

    @Autowired
    private DecorationMapper decorationMapper;

    /**
     * 查询装修情况
     *
     * @param decorationId 装修情况主键
     * @return 装修情况
     */
    @Override
    public Decoration selectDecorationByDecorationId(Long decorationId) {
        return decorationMapper.selectDecorationByDecorationId(decorationId);
    }

    /**
     * 查询装修情况列表
     *
     * @param decoration 装修情况
     * @return 装修情况
     */
    @Override
    public List<Decoration> selectDecorationList(Decoration decoration) {
        return decorationMapper.selectDecorationList(decoration);
    }

    /**
     * 新增装修情况
     *
     * @param decoration 装修情况
     * @return 结果
     */
    @Override
    public int insertDecoration(Decoration decoration) {
        decoration.setCreateTime(new Date());
        return decorationMapper.insertDecoration(decoration);
    }

    /**
     * 修改装修情况
     *
     * @param decoration 装修情况
     * @return 结果
     */
    @Override
    public int updateDecoration(Decoration decoration) {
        decoration.setUpdateTime(new Date());
        return decorationMapper.updateDecoration(decoration);
    }

    /**
     * 批量删除装修情况
     *
     * @param decorationIds 需要删除的装修情况主键
     * @return 结果
     */
    @Override
    public int deleteDecorationByDecorationIds(Long[] decorationIds) {
        return decorationMapper.deleteDecorationByDecorationIds(decorationIds);
    }

    /**
     * 删除装修情况信息
     *
     * @param decorationId 装修情况主键
     * @return 结果
     */
    @Override
    public int deleteDecorationByDecorationId(Long decorationId) {
        return decorationMapper.deleteDecorationByDecorationId(decorationId);
    }
}
